]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tools: Symlink node_modules in project root
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Oct 2025 18:12:59 +0000 (20:12 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 28 Oct 2025 20:40:31 +0000 (20:40 +0000)
NPM assumes quite strongly that it manages the project as a
whole and its package/lock files are located in the project
root.

While we somehow managed to keep the npm tooling in a subfolder,
this comes at the cost of breaking imports of additional modules.

This will become relevant when we update eslint to a supported
version, as we want to keep using the `junit` formatter in CI,
which has now been split out into a separate module.

So bite the bullet and make the node_modules folder available in
the project root.

On the plus side, having the node_modules folder in the project
root allows language servers in IDEs/editors to pick it up.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3929>

tools/run-eslint.sh

index b3c975632bc6b61bbbd94052a1c99adc38e3a6cf..bf3bc88178176e02c02bc69b298d0fee18d75423 100755 (executable)
@@ -3,6 +3,10 @@
 # SPDX-FileCopyrightText: 2020 Philip Chimento <philip.chimento@gmail.com>
 # SPDX-FileCopyrightText: 2025 Florian Müllner <fmuellner@gnome.org>
 
-cd $(dirname -- "$0")
+srcdir=$(dirname -- "$0")
+
+cd $srcdir
 [ ! -d node_modules ] && npm clean-install
+# Link in project root to make imports work properly
+[ ! -e ../node_modules ] && ln -s $srcdir/node_modules ../node_modules
 npm run lint -- "$@"